package org.fireflow2.designer.eclipse.policies.connection;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.BendpointEditPolicy;
import org.eclipse.gef.requests.BendpointRequest;
import org.fireflow2.designer.eclipse.commands.connection.CreateBendPointCommand;
import org.fireflow2.designer.eclipse.commands.connection.MoveBendPointCommand;
import org.fireflow2.designer.eclipse.commands.connection.RemoveBendPointCommand;
import org.fireflow2.designer.eclipse.modelwrapper.ConnectorWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.TransitionWrapper;

public class ConnectionBendpointEditPolicy extends BendpointEditPolicy {

	@Override
	protected Command getCreateBendpointCommand(BendpointRequest request) {
		// TODO Auto-generated method stub
		
		
		CreateBendPointCommand cmd = new CreateBendPointCommand((ConnectorWrapper)request.getSource().getModel(),
				request.getLocation(),request.getIndex());
		
		
		return cmd;
	}

	@Override
	protected Command getDeleteBendpointCommand(BendpointRequest request) {
		// TODO Auto-generated method stub
		RemoveBendPointCommand cmd = new RemoveBendPointCommand((ConnectorWrapper)request.getSource().getModel(),
				request.getLocation(),request.getIndex());
		return cmd;
	}

	@Override
	protected Command getMoveBendpointCommand(BendpointRequest request) {
		// TODO Auto-generated method stub

		MoveBendPointCommand cmd = new MoveBendPointCommand((ConnectorWrapper)request.getSource().getModel(),
				request.getLocation(),request.getIndex());
		
//		cmd.setReferencePoint(p);
		
		return cmd;
	}

}
